# Copyright 2018- The Pixie Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# SPDX-License-Identifier: Apache-2.0

load("@io_bazel_rules_docker//container:container.bzl", "container_image")

package(default_visibility = ["//src/stirling:__subpackages__"])

container_image(
    name = "ruby_image",
    base = "@ruby_base_image//image",
)

container_image(
    name = "curl_image",
    base = "@curl_base_image//image",
)

container_image(
    name = "datastax_image",
    base = "@datastax_base_image//image",
)

container_image(
    name = "mysql_image",
    base = "@mysql_base_image//image",
)

container_image(
    name = "postgres_image",
    base = "@postgres_base_image//image",
)

container_image(
    name = "redis_image",
    base = "@redis_base_image//image",
)

container_image(
    name = "dns_image",
    base = "@alpine_dns_base_image//image",
    layers = [
        "//src/stirling/source_connectors/socket_tracer/testing/containers/dns:bind_conf",
    ],
    visibility = ["//src/stirling:__subpackages__"],
)

container_image(
    name = "mysql_connector_image",
    base = "@python_mysql_connector_image//image",
    layers = [
        "//src/stirling/source_connectors/socket_tracer/testing/containers/mysql:mysql_scripts",
    ],
)

container_image(
    name = "nginx_openssl_1_1_0_image",
    base = "@nginx_openssl_1_1_0_base_image//image",
    layers = [
        "//src/stirling/source_connectors/socket_tracer/testing/containers/ssl:nginx_conf",
        "//src/stirling/source_connectors/socket_tracer/testing/containers/ssl:ssl_keys_layer",
    ],
)

container_image(
    name = "nginx_openssl_1_1_1_image",
    base = "@nginx_openssl_1_1_1_base_image//image",
    layers = [
        "//src/stirling/source_connectors/socket_tracer/testing/containers/ssl:nginx_conf",
        "//src/stirling/source_connectors/socket_tracer/testing/containers/ssl:ssl_keys_layer",
    ],
)

container_image(
    name = "nginx_alpine_openssl_3_0_8_image",
    base = "@nginx_alpine_openssl_3_0_8_base_image//image",
    layers = [
        "//src/stirling/source_connectors/socket_tracer/testing/containers/ssl:nginx_conf",
        "//src/stirling/source_connectors/socket_tracer/testing/containers/ssl:nginx_html",
        "//src/stirling/source_connectors/socket_tracer/testing/containers/ssl:ssl_keys_layer",
    ],
)

container_image(
    name = "nats_image",
    base = "@nats_base_image//image",
    layers = [
        "//src/stirling/source_connectors/socket_tracer/testing/containers/ssl:ssl_keys_layer",
    ],
)

container_image(
    name = "kafka_image",
    base = "@kafka_base_image//image",
)

container_image(
    name = "zookeeper_image",
    base = "@zookeeper_base_image//image",
)

[
    container_image(
        name = "node_%s_image" % node_version.replace(".", "_").replace("-", "_"),
        base = "@node_%s_linux_amd64_image//image" % node_version.replace(".", "_").replace("-", "_"),
        cmd = [
            "node",
            "/etc/node/https_server.js",
        ],
        layers = [
            "//src/stirling/source_connectors/socket_tracer/testing/containers/ssl:ssl_keys_layer",
            "//src/stirling/source_connectors/socket_tracer/testing/containers/ssl:node_client_server_layer",
        ],
    )
    for node_version in [
        "12.3.1",
        "14.18.1-alpine",
    ]
]

container_image(
    name = "amqp_image",
    base = "@rabbitmq_3_management//image",
)

container_image(
    name = "py_grpc_helloworld_image",
    base = "@py_grpc_helloworld_image//image",
)

container_image(
    name = "productcatalogservice_v0_2_0",
    base = "@productcatalogservice_v0_2_0//image",
)
